<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>{$region['title']}</title>
    <link rel="stylesheet" href="{MODULE_URL}template/mobile/style/style1/static/css/weui.css" />
    <link rel="stylesheet" type="text/css" href="{MODULE_URL}template/mobile/style/style1/static/css/region.css" />
    <link rel="stylesheet" href="{MODULE_URL}template/mobile/style/style1/static/css/comm.css">
    <script type="text/javascript" src="{MODULE_URL}template/mobile/style/style1/static/js/zepto.js"></script>
    <script type="text/javascript">
    var myurl = "{php echo $this->createMobileUrl('imgupload')}";
    </script>
    <!--图片上传js-->
    <script type="text/javascript" src="{$_W['siteroot']}app/resource/js/lib/jquery-1.11.1.min.js"></script>
    
    <script type="text/javascript" src="{MODULE_URL}template/mobile/style/style1/static/js/global.js">
    </script>

    <script type="text/javascript" src="{MODULE_URL}template/mobile/style/style1/static/js/seajs-0.1.5.js">
    </script>
    <script type="text/javascript" src="{MODULE_URL}template/mobile/style/style1/static/js/newthread.js">
    </script>
    <script type="text/javascript" charset="utf-8" src="{MODULE_URL}template/mobile/style/style1/static/js/jpegmeta.js">
    </script>
    <script type="text/javascript" charset="utf-8" src="{MODULE_URL}template/mobile/style/style1/static/js/jpeg.encoder.basic.js">
    </script>
    <script type="text/javascript" charset="utf-8" src="{MODULE_URL}template/mobile/style/style1/static/js/image_compress.js">
    </script>
    <style type="text/css">
    body {
        color: #777;
    }
    

    
    .fileInput {
        height: 100%;
        width: 100%;
        overflow: hidden;
        font-size: 300px;
        position: absolute;
        right: 0;
        top: 0;
        opacity: 0;
        filter: alpha(opacity=0);
        cursor: pointer;
    }
    
    .nav-ul li:hover {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }
    
    .nav {
        clear: both;
        width: 100%;
    }
    
    .nav-ul {
        margin: 8px 8px 0 2px;
        overflow: hidden;
    }
    
    .nav-ul li {
        float: left;
        width: 6.1em;
        height: 6.1em;
        margin: 0.5em 1.2em 1em 0;
        box-sizing: border-box;
        position: relative;
    }
    
    .nav-ul li div {
        width: 100%;
        height: 100%;
        line-height: 32px;
        font-size: 12px;
        text-align: center;
        background:url({MODULE_URL}template/mobile/style/style1/static/image/add-img.jpg) no-repeat center;
        background-size: 100%;
    }
    
    .nav-ul li div img {
        margin: 0 !important;
        width: 100%;
        height: 100%
    }
    </style>
</head>

<body>
    <header id="header">
        <div class="header_div">
            <div id="left_div" onClick="window.location.href='{php echo $this->createMobileUrl('fled',array('op' => 'list'))}'"></div>
            <div id="middle_div">
                <h1 id="title">我要发布</h1></div>
            <div id="right_div">
                <div class="right_bottom"></div>
                <div class="right_img"></div>
            </div>
        </div>
    </header>
    <div class="cont">
    <form role="form" method="post" enctype="multipart/form-data" name="newthread" id="newthread" class="form-horizontal">
        <div class="weui_cells weui_cells_form">
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">标题：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" placeholder="6-30字，不能写电话" id="tit" />
                </div>
            </div>
            <div class="weui_cell weui_cell_select weui_select_after">
                <div class="weui_cell_hd">
                    类型：
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <select class="weui_select" name="category" id='category' style="margin-left:-15px;">
                        {loop $categories $category}
                        <option value="{$category['id']}">{$category['name']}</option>
                        {/loop}
                    </select>
                </div>
            </div>
            <div class="weui_cell weui_cell_select weui_select_after">
                <div class="weui_cell_hd">
                    新旧：
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <select class="weui_select" name="rolex" id='rolex' style="margin-left:-15px;">
                        <option value='全新' {if $good[ 'rolex']=='全新' }selected{/if}>全新</option>
                        <option value='九成新' {if $good['rolex']=='九成新' }selected{/if}>九成新</option>
                        <option value='八成新' {if $good['rolex']=='八成新' }selected{/if}>八成新</option>
                        <option value='七成新' {if $good['rolex']=='七成新' }selected{/if}>七成新</option>
                        <option value='六成新' {if $good['rolex']=='六成新' }selected{/if}>六成新</option>
                        <option value='五成新' {if $good['rolex']=='五成新' }selected{/if}>五成新</option>
                        <option value='四成新' {if $good['rolex']=='四成新' }selected{/if}>四成新</option>
                    </select>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">价格：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" placeholder="多少元,必填" id="zprice" />
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">姓名：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" value="{$member['realname']}" id="realname" />
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">电话：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" value="{$member['mobile']}" id="mobile" />
                </div>
            </div>
            <a style="height:20px;width:100%;background-color: #efeef4;display:block"></a>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea class="weui_textarea" placeholder="请填写详情说明,长度5-200个字之间。" rows="3" id="description"></textarea>
                    <div class="weui_textarea_counter"><span>0</span>/200</div>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <!-- <div class="pjimg_div">
                        <dl class="pjadd_img">
                        </dl>
                        <div class="addimg_div">
                            <input class="addimg" type="file" id="j-file" accept="image/jpeg" />
                        </div>
                    </div> -->
                    <div class="tipLayer">
                        <div class="photoList">
                            <ul>
                                <li class="on" id="addPic">
                                    <input type="file" class="on needsclick" style="z-index:200;opacity:0;filter:alpha(opacity=0);-ms-filter:'alpha(opacity=0)';" id="uploadFile" accept="image/*" single>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
        <div class="bd spacing" style="text-align:center;margin-top:10px;">
            <a href="javascript:;" class="weui_btn weui_btn_primary" id="showToast" style="width:80%">提交信息</a>
        </div>
        <div id="toast" style="display: none;">
            <div class="weui_mask_transparent"></div>
            <div class="weui_toast">
                <i class="weui_icon_toast"></i>
                <p class="weui_toast_content">成功提交</p>
            </div>
        </div>
    </div>
    
    <script type="text/javascript">
    $(function() {
        $("#showToast").click(function(event) {
            var description = $("#description").val();
            if (description == '') {
                alert('描述不能为空！');
                return false
            };
            if (description.length <= 5 || description.length >= 200) {
                alert('描述必须大于5个小于200个字');
                return false
            };
            var category = $("#category").val();
            var rolex = $("#rolex").val();
            var zprice = $("#zprice").val();
            var realname = $("#realname").val();
            var mobile = $("#mobile").val();
            var title = $("#tit").val();
            var picIds ='';
            $('input[name="picIds[]"]').each(function(){
                var t1 = $(this).val();
                   picIds += t1+',';
            });
            $.ajax({
                url: "{php echo $this->createMobileUrl('fled',array('op' => 'add'))}",
                dataType: 'json',
                data: {
                    description: description,
                    category: category,
                    rolex: rolex,
                    zprice: zprice,
                    realname: realname,
                    mobile: mobile,
                    title: title,
                    picIds :picIds
                },
                success: function(s) {
                    if (s.status == 1) {
                        $('#toast').show();
                        setTimeout(function() {
                            $('#toast').hide();
                            window.location.href ="{php echo $this->createMobileUrl('fled',array('op' => 'list'))}";
                        }, 3000);
                    };
                }
            })


        });
    })
    </script>
   
    {template 'style/style1/footer'}
</body>

</html>
